package com.h819.core.web.jqgrid;

import org.apache.log4j.Logger;

/**
 * @Title: JqgridEditAction.java
 * @Description: TODO(继承 JqgridEditBaseAction，可以自动捕获 oper 参数值)
 * @author H819
 * @date 2010-3-11
 * @version V1.0
 */
public class JqgridEditAction extends JqgridEditBaseAction {

	private Logger log = Logger.getLogger(JqgridEditAction.class);

	// 其他参数处理和一般的 struts2 的 action 没什么两样了

	// 下面的参数，由 struts2 请求自动赋值
	private String id;
	private String userName;
	private String gender;
	private String email;
	private String QQ;
	private String mobilePhone;
	private String birthday;

	public String execute() throws Exception {
		String oper = this.getOper();
		log.info(" jqgrid 传过来的 oper 参数是：" + oper);
		//根据传递过来的不同的编辑标志，执行相应的方法
		if (oper.equals("edit"))
			edit();

		if (oper.equals("add"))
			add();

		if (oper.equals("del"))
			del();

		return null;
	}

	private void edit() {
		log.info("jqgrid, execute edit method.");
		log.info("pram :");
		log.info("id :" +this.getId());
		log.info("Username :" +this.getUserName());
		log.info("Gender :" +this.getGender());
		log.info("Email :" +this.getEmail());
		log.info("QQ :" +this.getQQ());
		log.info("MobilePhone :" +this.getMobilePhone());
		log.info("Birthday :" +this.getBirthday());
	}

	private void add() {
		log.info("jqgrid, execute add method.");
	}

	private void del() {
		log.info("jqgrid, execute del method." +" jqgrid 传过来的 id 参数是：" + this.getId());
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getQQ() {
		return QQ;
	}

	public void setQQ(String qQ) {
		QQ = qQ;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

}
